fix(tui): prevent crash when task references missing child session#26944
fix(tui): prevent crash when task references missing child session#26944shalin-dev wants to merge 6 commits into
Conversation
The Task component's onMount fires sync.session.sync(sessionId) as a fire-and-forget promise without .catch(). When the child session has been deleted or doesn't exist, the unhandled rejection crashes the TUI. Guard the onClick navigation with a childExists memo to prevent navigating to a dead-end session view for missing sessions. Closes anomalyco#26871
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
|
…issing sessions - Replace childExists memo (checked stale cache) with sessionMissing signal that tracks actual sync failure outcome - Record error in .catch() instead of swallowing it silently - Conditionally pass onClick (undefined when session missing) so InlineTool removes click affordance entirely — no misleading clickable-but-dead state - Remove synthetic test — no TUI testing infrastructure exists in codebase
|
Thanks for the thorough review @kommander — all feedback addressed in this push. Changes:
Net diff: +12 -34 lines |
…g-child-session # Conflicts: # packages/opencode/src/cli/cmd/tui/routes/session/index.tsx
|
Resolved merge conflicts with upstream/dev. The fix now incorporates the new retry error dialog feature:
|
Issue for this PR
Closes #26871
Type of change
What does this PR do?
The Task component in the session TUI route fires sync.session.sync(sessionId) as a fire-and-forget promise (void ...) without .catch(). When the child session referenced by a task tool part has been deleted or doesn't exist, the SDK call throws and the unhandled promise rejection crashes the TUI process.
Two changes:
Added .catch(() => {}) to the void sync.session.sync() call in onMount. This is a fire-and-forget sync with no user-facing error to show, so swallowing the rejection is appropriate. The sync was only needed to populate local state for a session that no longer exists.
Added a childExists memo that checks sync.data.session for the child session ID, and guards the onClick navigation with it. Without this, clicking a task row for a missing session would navigate to a dead-end session view.
How did you verify your code works?
Screenshots / recordings
N/A - TUI behavior change, no visual diff.
Checklist